package cn.huq.day03

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object UnionDemo {
  def main(args: Array[String]): Unit = {
    val conf: SparkConf = new SparkConf().setAppName("UnionDemo").setMaster("local")
    val sc = new SparkContext(conf)

    val arr1: Array[Int] = Array(1, 2, 3, 4)
    val rdd1: RDD[Int] = sc.parallelize(arr1, 2)

    val arr2: Array[Int] = Array(2, 3, 3, 4)
    val rdd2: RDD[Int] = sc.parallelize(arr1, 3)

    val rdd3: RDD[Int] = rdd1.union(rdd2)

    println(rdd3.collect().toBuffer)




  }

}
